

FROM golang:1.17-alpine AS builder
ENV GO111MODULE=on
# ENV GOPROXY=https://goproxy.cn,direct
WORKDIR /build

COPY go.mod .
COPY go.sum .

RUN go mod tidy

COPY . .

RUN go build -o ./gateway .

FROM alpine
WORKDIR /

ENV MYSQL_PATH=mysql:3306
ENV MYSQL_USER=root
ENV MYSQL_PASSWORD=123456
ENV REDIS_PATH=redis:6379
ENV REDIS_USER=root
ENV REDIS_PASSWORD=""


COPY --from=builder /build/gateway /

EXPOSE 16010

CMD ["/gateway"]
